<template>
  <div>
    <div style="height:50px;line-height:50px;background:#eee">
      <span class="iconfont icon-left" style="padding:0 10px" @click="goUpperStory()"></span>
      <span>绑定支付密码</span>
    </div>
    <div style="padding:0 10px">
      <div>
        <van-cell-group>
          <van-field v-model="password" type="password" label="支付密码" placeholder="请输入密码" required />
          <van-field
            v-model="rePassword"
            type="password"
            label="重复支付密码"
            placeholder="请输入密码"
            required
          />
        </van-cell-group>
        <div style="margin-top:20px">
          <van-button type="primary" block @click="buildPassword()">确认绑定</van-button>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data: () => ({
    password: null,
    rePassword: null
  }),
  mounted() {},
  methods: {
    goUpperStory() {
      this.$router.go(-1);
    },
    buildPassword() {
      let data = {
        paypassword: this.password,
        rePaypassword: this.rePassword
      };
      //console.log("绑定");
      this.$axios.post(`ym/memberuser/bind-pay-password`, data).then(msg => {
        if (msg.data.code === 0) {
          this.$Notify({ type: "success", message: msg.data.msg });
        } else {
          this.$Notify({ type: "danger", message: msg.data.msg });
        }
      });
    }
  }
};
</script>